package org.hhgzs.modules.erp.service.impl;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.hhgzs.modules.erp.entity.MaterialCategory;
import org.hhgzs.modules.erp.exception.JshException;
import org.hhgzs.modules.erp.mapper.MaterialCategoryMapper;
import org.hhgzs.modules.erp.service.MaterialCategoryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.hhgzs.modules.erp.vo.TreeNode;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 产品类型表 服务实现类
 * </p>
 *
 * @author peiqy
 * @since 2021-07-14
 */
@Service
@Slf4j
@RequiredArgsConstructor
public class MaterialCategoryServiceImpl extends ServiceImpl<MaterialCategoryMapper, MaterialCategory> implements MaterialCategoryService {
    private  final  MaterialCategoryMapper materialCategoryMapper;
    @Override
    public List<TreeNode> getMaterialCategoryTree(Long id) {
        List<TreeNode> list=null;
        try{
            list=materialCategoryMapper.getNodeTree(id);
        }catch(Exception e){
            JshException.readFail(log, e);
        }
        return list;
    }
}
